#include "stdafx.h"

#include "MainMenuPainter.h"
#include "IResCfg.h"
#include "CMSGInforCon.h"
#include "CMSGDefaultCon.h"

CMSGDefaultCon::CMSGDefaultCon(HWND hWnd):CMSGInforCon(hWnd)
{

}

CMSGDefaultCon::~CMSGDefaultCon(void)
{
}

BOOL CMSGDefaultCon::InitControls(DWORD dwData)
{
	//message box
	LANGUAGE_DECLARE;
	FONT_DECLARE;

	HBITMAP hBitmap = NULL;

	CIResCfg ResCon;
	if(!ResCon.Init(L"MSGDefault.xml"))
	{
		//g_App.ShowMsgBox(CMD_MSGBOX_OK,L"",LAN_GETTEXT(Msg_ResError));
		return FALSE;
	}

	m_nAniType  = ResCon.GetAniType();
	m_nExitAniType=ResCon.GetExitAniType();
	m_nAniSpeed = ResCon.GetAniSpeed();
	SetRect(ResCon.GetRect());
	BOOL bFromDll = ResCon.IsResFromDll();
	BtnParam btnInfo;

	hBitmap = CUtil::LoadBitmapEx(ResCon.GetImage(),bFromDll);
    this->SetMaskBmp(hBitmap);

	BatTimePicParam picInfo;
	ResCon.GetBatTimePicParam(picInfo,L"Pic_Bkgnd");
	CPicture *pPic = (CPicture*)AddControl(new CPicture(SWS_STATIC, L"",picInfo.m_rc, CMD_MSGBOX_PIC));
	ResCon.SetPicParam(pPic,picInfo);

	TextParam txtInfo;
	CText* pText=NULL; 


	//{
	ResCon.GetTextParam(txtInfo,L"Text_Msg");
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_FACTORY),txtInfo.m_rc, CMD_MSG_FITSTREAM_TEXT));
	ResCon.SetTextParam(pText,txtInfo);
	//}

   CBmpBtn *pBtn=NULL;

	ResCon.GetBtnParam(btnInfo,L"Btn_No");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,LAN_GETTEXT(TXT_CANCLE),btnInfo.m_rc, CMD_MSG_DEFAULT_NO));
	ResCon.SetBtnParam(pBtn,btnInfo);

	ResCon.GetBtnParam(btnInfo,L"Btn_Yes");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,LAN_GETTEXT(MSG_OK),btnInfo.m_rc, CMD_MSG_DEFAULT_YES));
	ResCon.SetBtnParam(pBtn,btnInfo);
	SetPainter(new CMainMenuPainter());
	return 1;

}



void  CMSGDefaultCon::OnCommand(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
	
}